{literal}{extend name="public/layout"}
{block name="head"}
{:_css('static/css/weui.css')}
{:_css('css/weui2.css')}
{/block}
{block name="title"}在线预约{/block}
{block name="content"}
{/literal}
<div class="form mt10" id="form1">
    {volist name="formFields" id="vo"}
    {if condition="$vo.field neq 'id' && $vo.field neq 'member_id' && $vo.field neq 'create_time'"}
    <div class="flex border-b">
        <label for="{$vo.field}">{$vo.title}</label>
        <div class="flex-con">
            <input type="text" autocomplete="off" class="form-control" name="{$vo.field}" id="{$vo.field}" placeholder="请输入{$vo.title}">
        </div>
    </div>
    {/if}
    {/volist}
</div>

<div class="btn-area">
    <div id="submitBtn" class="bg-primary btn-block btn">保存提交</div>
</div>
{literal}
{:_js('static/layermobile/layer.js')}
{:_js('js/phone.js')}
{:_js('static/js/zepto.min.js')}
{:_js('static/js/weui.js')}
{:_js('js/picker.js')}
{/literal}

<script>
    $(function () {
        $('#submitBtn').on('click', function () {
            var postData = {};
            var is_valid = true;
            $('#form1').find('input[name],textarea[name]').each(function () {
                if(!this.value.trim() && this.name != 'address'){
                    is_valid = false;
                    ui.msg($(this).attr('placeholder'));
                    return false;
                }
                postData[this.name] = this.value.trim();
            });
            if(is_valid){
                ui.toast.show();
                $.post("{literal}{:U('save')}{/literal}",postData, function (rt) {
                    ui.toast.hide();
                    if(rt.status==1){
                        location.href = "{literal}{:U('saveResult')}{/literal}";
                    }else{
                        ui.msg(rt.info);
                    }
                },'json');
            }
        });
    });
</script>
{literal}
{/block}
{/literal}